home *** CD-ROM | disk | FTP | other *** search
/ Linux Cubed Series 7: Sunsite / Linux Cubed Series 7 - Sunsite Vol 1.iso / system / admin / linuxcon.000 / linuxcon / linuxconf-1.6 / dialog / fstrhelp.c < prev    next >
C/C++ Source or Header  |  1996-08-01  |  1KB  |  48 lines

  1. #include <string.h>
  2. #include <stdlib.h>
  3. #include <ctype.h>
  4. #include "diadef.h"
  5. #include "dialog.h"
  6.  
  7. /*
  8.     This class is a virtual class.
  9.     This is the building block for combo-type widget. It edit like
  10.     a string, but a hotkey may trigger a helper function which
  11.     may bring a help dialog or a pick list.
  12.     
  13.     This class do the drawing of the little button at the end of
  14.     the string (an arrow in popular GUI toolkit). It intercept the
  15.     hotkey and trigger the assist function (which must be derived).
  16. */
  17. PUBLIC FIELD_STRING_HELP::FIELD_STRING_HELP(
  18.     const char *_prompt,
  19.     SSTRING &_str)
  20.     : FIELD_SSTRING (_prompt,_str)
  21. {
  22. }
  23.  
  24. /*
  25.     Draw only the input part of a field
  26. */
  27. PUBLIC void FIELD_STRING_HELP::drawtxt (WINDOW *dialog)
  28. {
  29.     FIELD_STRING_BASE::drawtxt(dialog);
  30.     // Add the little button
  31.     wattrset(dialog, inputbox_attr);
  32.     wmove(dialog, box.y,box.x+box.width-1);
  33.     waddch (dialog,ACS_DARROW);
  34. }
  35.  
  36. PUBLIC void FIELD_STRING_HELP::dokey (
  37.     WINDOW *dialog,
  38.     int key,
  39.     FIELD_MSG &msg)
  40. {
  41.     if (key == 24){
  42.         if (!is_readonly()) assist(dialog);
  43.     }else{
  44.         FIELD_SSTRING::dokey(dialog,key,msg);
  45.     }
  46. }
  47.  
  48.